org 0x7c00
bits 16
; In x86 real mode, 
; the Code Segment (CS) register cannot be
; directly modified using instructions like MOV CS, AX.
; Instead, its value is changed through control transfer instructions
; that involve a change in the code segment.
jmp 0:step1
step1:
mov ax,cs
mov ds,ax
mov ss,ax
mov es,ax
mov fs,ax
mov gs,ax
mov sp,0x7c00
mov bp,0x7c00


mov ah,0x06 ;清屏
mov al,0x00 ;清屏
mov ch,0   ;左上角的行号
mov cl,0   ;左上角的列号
mov dh,20  ;右下角的行号
mov dl,79  ;右下角的行号
mov bh,0x0f;属性
int 0x10


mov ah,0x02 ;设置游标
mov dh,0x00 ;dh列数
mov dl,0x00 ;dl行数
mov bh,0x00 ;bh页码
int 0x10


mov ah,0x13 ;打印
mov al,0x01 ;写入模式
mov cx,0x0a ;字符串长度
mov dh,0x00 ;游标行列号
mov dl,0x00
mov bp,helloworld ;es:bp字符串内存地址
mov bh,0x00 ;页码
mov bl,0x07 ;颜色属性
int 0x10
jmp $

helloworld: db 'helloworld'
times 510 - ($ - $$) db 0
dw 0xaa55